import React, {FC} from 'react';
import {createNativeStackNavigator} from '@react-navigation/native-stack';

import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';

const Stack = createNativeStackNavigator();
type TRoute = {
  name: string;
  component:
    | React.ComponentType<{
        route: any;
        navigation: any;
      }>
    | React.ComponentType<{}>;
};
const Route: FC<{component: Array<TRoute>}> = ({component}) => {
  return (
    <Stack.Navigator
      initialRouteName={component[0].name}
      screenOptions={{
        animation: 'slide_from_right',
      }}>
      {component.map(item => (
        <Stack.Screen
          key={item.name}
          name={item.name}
          component={item.component}
          options={{
            presentation: 'card',
          }}
        />
      ))}
    </Stack.Navigator>
  );
};

export default Route;
